package util;

import java.sql.Connection;
import java.sql.SQLException;

import org.junit.Test;
import com.feilo.entity.User;
import com.mysql.jdbc.ResultSet;
import com.mysql.jdbc.Statement;

/**
 * @Email   
 * @author   
 * @version  
 */
public class UserBizTest {
	@Test
	public static User getUser(Integer id){
		User user = null;
		Connection con = null ;
		try {
			con = getConn("localhost", "3306", "test", "root", "root");
			String sql = "select * from user where id="+id;
			Statement st = (Statement) con.createStatement();
			ResultSet rs = (ResultSet) st.executeQuery(sql);			
			if(rs.next()){
				user = new User();
				user.setId(id);
				user.setU_username(rs.getString("name"));
				user.setU_password("password");
			}			
		} catch (Exception e) {
			e.printStackTrace();
		} finally{
			if(con!=null){
				try {
					con.close();
				} catch (SQLException e) {
					e.printStackTrace();
				}
			}
		}
		return user ;
	}

	private static Connection getConn(String string, String string2,
			String string3, String string4, String string5) {
		// TODO Auto-generated method stub
		return null;
	}
}
